package com.ai.entity.server;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import org.springframework.beans.BeanUtils;

import java.io.Serializable;
import java.util.Date;

/**
 * 网页返回对象
 */
@Data
@Accessors(chain = true)
@JsonInclude(JsonInclude.Include.NON_NULL)
public class ServerVO implements Serializable {

    @ApiModelProperty(value = "主键,主键ID")
    private Integer id;

    @ApiModelProperty(value = "代号（备用主键）")
    private String code;

    @ApiModelProperty(value = "服务器名")
    private String nickname;

    @ApiModelProperty(value = "服务器帐号")
    private String username;

    @ApiModelProperty(value = "服务器IP")
    private String ip;

    @ApiModelProperty(value = "服务器端口号")
    private Integer port;

    @ApiModelProperty(value = "状态(1.开，2.关，-1.弃用)")
    private Integer state;

    @ApiModelProperty(value = "数据添加时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date createTime;

    @ApiModelProperty(value = "备注")
    private String remark;

    public static ServerVO convertPOToVO(ServerPO serverPO) {
        ServerVO serverVO = new ServerVO();
        BeanUtils.copyProperties(serverPO, serverVO);
        return serverVO;
    }
}
